package com.zhangjie.internalcommon.util;

/**
 * redis 前缀的一个工具集合
 * @Auther: zj
 * @Date: 2024/2/3 - 02 - 03 - 8:34
 * @Description: com.zhangjie.internalcommon.util
 * @version: 1.0
 */
public class RedisPrefixUtils {

    // 用户验证码的前缀
    public static String verificationCodePrefix = "verification-code-";

    // token存储的前缀
    public static String tokenPrefix = "token-";

    // 黑名单设备号前缀
    public static String blackDeviceCodePrefix = "black-device-";

    /**
     * 根据手机号生成key（验证码的key）
     * @param phone
     * @param identity
     * @return
     */
    public static String generatorKeyByPhone(String phone, String identity){
        return verificationCodePrefix + identity + "-"+ phone;
    }

    /**
     * 根据手机号和身份标识，生成token key
     * @param phone
     * @param identity
     * @return
     */
    public static String generatorTokenKey(String phone, String identity, String tokenType){
        return tokenPrefix + phone + "-" + identity + "-" + tokenType;
    }
}
